package gui;

import java.awt.Color;
import java.awt.Font;

/**
 *
 * @author Mariano Zapata
 */
public class RenderPestania extends javax.swing.JPanel {

    private static final Font NEGRITA= new Font("Tahoma", Font.BOLD, 11);
    private static final Font PLANA= new Font("Tahoma", Font.PLAIN, 11);
    
    private InterfazPestania componente;
    
    /**
     * Creates new form RenderPestania
     */
    public RenderPestania()
    {
        initComponents();
        componente= null;
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        titulo = new javax.swing.JLabel();
        cruz = new javax.swing.JLabel();

        setOpaque(false);

        titulo.setText("jLabel1");

        cruz.setFont(new java.awt.Font("Lucida Console", 1, 14)); // NOI18N
        cruz.setText("x");
        cruz.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseExited(java.awt.event.MouseEvent evt) {
                mouseSalio(evt);
            }
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                mouseClick(evt);
            }
            public void mouseEntered(java.awt.event.MouseEvent evt) {
                mouseEntro(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addComponent(titulo)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(cruz))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                .addComponent(titulo)
                .addComponent(cruz))
        );
    }// </editor-fold>//GEN-END:initComponents

    private void mouseEntro(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_mouseEntro
        cruz.setForeground(Color.red);
    }//GEN-LAST:event_mouseEntro

    private void mouseSalio(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_mouseSalio
        cruz.setForeground(Color.black);
    }//GEN-LAST:event_mouseSalio

    private void mouseClick(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_mouseClick
        componente.cerrar();
    }//GEN-LAST:event_mouseClick

    public void setPanel(InterfazPestania componente) {
        this.componente = componente;
    }
    
    public void setTitulo(String titulo) {
        this.titulo.setText(titulo);
    }
    
    public void modificado(boolean valor)
    {
        if (valor)
            titulo.setFont(NEGRITA);
        else
            titulo.setFont(PLANA);
    }
    
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JLabel cruz;
    private javax.swing.JLabel titulo;
    // End of variables declaration//GEN-END:variables
}
